<template>
  <div class="dashboard-editor-container">
    <div style="padding: 14px">
      <h1
        style="
          font-family: Montserrat, Nunito, sans-serif;
          font-weight: 400;
          font-size: 24px;
        "
      >
        <span>智慧上杨&nbsp;</span>
        <small style="font-size: 15px; color: #777; padding-left: 5px"
          >数据面板</small
        >
      </h1>
    </div>
    <div class="dashboard">
      <el-row
        :gutter="40"
        style="display: flex; justify-content: space-between"
      >
        <el-col :md="8">
          <panel-group @handleSetLineChartData="handleSetLineChartData" />
        </el-col>
        <!-- style="background: #fff; padding: 10px 10px 0; margin-bottom: 32px" > -->
        <el-col :md="8" style="background: #fff; padding: 14px">
          <line-chart :chart-data="lineChartData" />
        </el-col>
      </el-row>
      <br />
      <el-row
        :gutter="40"
        style="display: flex; justify-content: space-between"
      >
        <el-col
          :xs="24"
          :sm="24"
          :md="8"
          :lg="8"
          style="background: #fff; padding: 14px"
        >
          <div
            class="el-card-header"
            style="
              display: flex;
              justify-content: space-between;
              align-items: center;
            "
          >
            <h4 style="font-size: 1.2rem; font-weight: 500">消费用户比</h4>
            <el-select v-model="value" placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </div>
          <pie-chart />
        </el-col>
        <el-col
          :xs="{ span: 24 }"
          :sm="{ span: 12 }"
          :md="{ span: 12 }"
          :lg="{ span: 6 }"
          :xl="{ span: 6 }"
          style="background: #fff; padding: 14px"
        >
          <box-card :chart-data="lineChartData" />
        </el-col>
      </el-row>
      <!-- <el-row :gutter="8">
        <el-col
          :xs="{ span: 24 }"
          :sm="{ span: 24 }"
          :md="{ span: 24 }"
          :lg="{ span: 12 }"
          :xl="{ span: 12 }"
          style="padding-right: 8px; margin-bottom: 30px"
        >
          <transaction-table />
        </el-col>
        <el-col
          :xs="{ span: 24 }"
          :sm="{ span: 12 }"
          :md="{ span: 12 }"
          :lg="{ span: 6 }"
          :xl="{ span: 6 }"
          style="margin-bottom: 30px"
        >
          <todo-list />
        </el-col>
      </el-row> -->
    </div>
  </div>
</template>

<script>
import * as menu from "@/api/menu";
import PanelGroup from "./components/PanelGroup";
import LineChart from "./components/LineChart";
// import RaddarChart from "./components/RaddarChart";
import PieChart from "./components/PieChart";
// import BarChart from "./components/BarChart";
// import TransactionTable from "./components/TransactionTable";
// import TodoList from "./components/TodoList";
import BoxCard from "./components/BoxCard";

const lineChartData = {
  newVisitis: {
    expectedData: [100, 120, 161, 134, 105, 160, 165],
    actualData: [120, 82, 91, 154, 162, 140, 145],
  },
  messages: {
    expectedData: [200, 192, 120, 144, 160, 130, 140],
    actualData: [180, 160, 151, 106, 145, 150, 130],
  },
  purchases: {
    expectedData: [80, 100, 121, 104, 105, 90, 100],
    actualData: [120, 90, 100, 138, 142, 130, 130],
  },
  shoppings: {
    expectedData: [130, 140, 141, 142, 145, 150, 160],
    actualData: [120, 82, 91, 154, 162, 140, 130],
  },
};

export default {
  name: "DashboardAdmin",
  components: {
    PanelGroup,
    LineChart,
    // RaddarChart,
    PieChart,
    // BarChart,
    // TransactionTable,
    // TodoList,
    BoxCard,
  },
  data() {
    return {
      options: [
        {
          value: "选项1",
          label: "Last 7 Days",
        },
        {
          value: "选项2",
          label: "Last 28 Days",
        },
        {
          value: "选项3",
          label: "Last Month",
        },
        {
          value: "选项4",
          label: "Last Year",
        },
      ],
      value: "Last 7 Days",
      lineChartData: lineChartData.newVisitis,
    };
  },
  methods: {
    getlist() {
      menu.getmenuList().then(
        function (res) {
          console.log(res.data);
        },
        function (error) {
          console.log(error);
        }
      );
      // console.log(res.data);
    },
    handleSetLineChartData(type) {
      this.lineChartData = lineChartData[type];
    },
  },
};
</script>

<style lang="scss" scoped>
.dashboard {
  // display: flex;
  padding: 32px;
  background-color: rgb(240, 242, 245);
  position: relative;
  // justify-content: space-between;
  .github-corner {
    position: absolute;
    top: 0px;
    border: 0;
    right: 0;
  }

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}
.col,
.col-1,
.col-2,
.col-3,
.col-4,
.col-5,
.col-6,
.col-7,
.col-8,
.col-9,
.col-10,
.col-11,
.col-12,
.col-auto,
.col-lg,
.col-lg-1,
.col-lg-2,
.col-lg-3,
.col-lg-4,
.col-lg-5,
.col-lg-6,
.col-lg-7,
.col-lg-8,
.col-lg-9,
.col-lg-10,
.col-lg-11,
.col-lg-12,
.col-lg-auto,
.col-md,
.col-md-1,
.col-md-2,
.col-md-3,
.col-md-4,
.col-md-5,
.col-md-6,
.col-md-7,
.col-md-8,
.col-md-9,
.col-md-10,
.col-md-11,
.col-md-12,
.col-md-auto,
.col-sm,
.col-sm-1,
.col-sm-2,
.col-sm-3,
.col-sm-4,
.col-sm-5,
.col-sm-6,
.col-sm-7,
.col-sm-8,
.col-sm-9,
.col-sm-10,
.col-sm-11,
.col-sm-12,
.col-sm-auto,
.col-xl,
.col-xl-1,
.col-xl-2,
.col-xl-3,
.col-xl-4,
.col-xl-5,
.col-xl-6,
.col-xl-7,
.col-xl-8,
.col-xl-9,
.col-xl-10,
.col-xl-11,
.col-xl-12,
.col-xl-auto {
  position: relative;
  width: 100%;
  padding-right: 14px;
  padding-left: 14px;
}
@media (max-width: 1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
